<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/pc/jsp/common/common.jsp"%>
<% 
  String userid=(String)CacheClass.isLogin(request,response);
 if(CacheClass.getIntValue(userid)==0)
 {
 	out.println("<script language='JavaScript'>alert('您还没有登陆！');location.href=document.referrer;</script>"); //后退并刷新
 } 

%>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <title>我的提现</title>
</head>
<body class='bcf'>

<div class="of jz" style="width: 90%;margin-top: 24px;">
   <div id="rmbListDiv">
   
   </div>

 	<!-- 分页 -->
	<div class="c9 f12 lh2 tc mgt30 pageBlock">
		<ul class='db fr of' style="margin-bottom:0px;" id="listPage"></ul>
	</div>

</div>

<div class="of" style="margin-left: 138px;margin-top: 57px;">
    <div class="mgt10 clearfix of">
        <input type="button" value="申请提现" onclick="toLocation('pc/applyWithdrawals.jsp')" class="cf bcblue br3 mgt10 tc cursor" style="font-size: 24px;height: 55px;line-height: 55px;width: 318px">
    </div>
</div>

<script>
var curpage=1;
var taotal=1;

function loadRmbwithdrawList(curpageForChat)
{
	if(curpageForChat==0) return;
	$.ajax({
            url: "PlugServlet",
            data: JSON.stringify({m:216,curpage:curpageForChat}),
            type: 'post',
            dataType: 'json',
            contentType:"application/json;charset=utf-8",
            success: function (data) {
            	console.log(data);
   	           if(data['state']==1)
	           {
	           		curpage=data.curpage*1;
	           		taotal=data.total*1;
	           		
	           		//更新分页
	           		$("#listPage").html('');
	           		if(taotal>1)
 	           		{
		           		var start=1;
		           		if(curpage-3>1)
		           		{
		           			start=curpage-3;
		           		}
		           		var end=taotal;
		           		if(curpage+3<taotal)
		           		{
		           			end=curpage+3;
		           		}
		           		var ChatPageHtml="";
		           		if(curpage!=1)
		           		{   //上一页
		           			ChatPageHtml='<li> <a href="javascript:loadRmbwithdrawList('+(curpage-1)+');" class="page-up">&lt;&nbsp;上一页</a></li>';
		           		}
		           		for(var i = start;i<end+1;i++)
		           		{
		           			if(i==curpage) //当前页
		           			{
		           				ChatPageHtml=ChatPageHtml+'<li><a href="javascript:void(0);" class="active">'+i+'</a></li>';
		           			}
		           			else
		           			{
		           				ChatPageHtml=ChatPageHtml+'<li><a href="javascript:loadRmbwithdrawList('+i+');">'+i+'</a></li>';
		           			}
		           		}
		           		if(curpage!=taotal)
		           		{   //下一页
		           			ChatPageHtml=ChatPageHtml+'<li><a href="javascript:loadRmbwithdrawList('+(curpage+1)+');" class="page-down">下一页&nbsp;&gt;</a></li>';
		           		}
		           		
						$("#listPage").html(ChatPageHtml);
	         		}
	                //数据
	                
	           		
					var contentHtml="";
					if(data.list==null)  return;
	           		$.each(data.list, function(index, objVal) { //遍历对象数组，index是数组的索引号，objVal是遍历的一个对象。
	           		    
	           		       contentHtml=contentHtml+'<div class="of">'+
						       '<div class="tixianDiv1 clearfix of">';
						   if((objVal.state*1.0)==3 || (objVal.state*1.0)==5) 
						   {     
						            console.log(objVal.state*1.0); 
						            contentHtml=contentHtml+'<div class="fl f17 c3">'+
						                '<p>状态</p>'+
						                '<p class="mgt20">类型</p>'+
						            '</div>'+
						            '<div class="fl" style="margin-left: 22px;">'+
						                '<p class="cred f17">'+objVal.statename+'</p>'+
						                '<p class="corange f15 mgt20">余额提现</p>'+
						            '</div>';
						  }
						  else
						  {
						  			console.log(objVal.state*1.0); 
						  			contentHtml=contentHtml+'<div class="fl f17 c3">'+
						                '<p>状态</p>'+
						                '<p class="mgt20">类型</p>'+
						            '</div>'+
						            '<div class="fl" style="margin-left: 22px;">'+
						                '<p class="corange f17">'+objVal.statename+'</p>'+
						                '<p class="corange f15 mgt20">余额提现</p>'+
						            '</div>';
						  }
						  contentHtml=contentHtml+'<div class="fr f15 c9"  style="margin-left: 16px;">'+
						                '<p>'+objVal.timeAbout+'</p>'+
						                '<p class="mgt20">'+objVal.finishtimeAbout+'</p>'+
						            '</div>'+
						            '<div class="fr f17 c3">'+
						                '<p>提现时间</p>'+
						                '<p class="mgt20">提现结束</p>'+
						            '</div>'+
						        '</div>'+
						        '<div class="tixianDiv2 clearfix of" >'+
						            '<p class="f17 c3 fl">提现金额</p>'+
						            '<div class="fl c3 fw600">'+
						                '<span f20>&yen;</span><span class="f29">'+objVal.rmb+'</span><span class="f24"></span>'+
						            '</div>'+
						        '</div>';
						          if((objVal.state*1.0)==5){
						          	contentHtml=contentHtml+ '<div class="tixianDiv2 clearfix of">'+
													            '<p class="f17 c3 fl">失败原因</p>'+
													            '<div class="fl c3 fw600" style="margin-top:22px;">'+
													                '<span class="c9 f17">'+objVal.errormsg+'</span>'+
													            '</div>'+
													        '</div>';
						          }
						       
						         contentHtml=contentHtml+'<div style="border-bottom: 1px solid #ddd;">'+
						        '</div>'+
						    '</div>';
				    });
	           		if(contentHtml=="")
	           			$("#rmbListDiv").html('<p></p><p></p><p></p><p></p>');
	           		else
	           			$("#rmbListDiv").html(contentHtml);
	           
	           }
       		},
            error: function (data) {
                 return false;
            },
         });	
}


$().ready(function() {   
 
    loadRmbwithdrawList(1);
    
 });
 
</script> 

</body>
</html>